package com.example.myapplication.window;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.example.myapplication.R;

public class HintDialog extends Dialog {
    public HintDialog(@NonNull Context context) {
        super(context, R.style.MyDialog);
        setContentView(R.layout.dialog_hint);
    }


    public void showIt(String title,CallBack callBack){
        show();
        TextView textView = (TextView) findViewById(R.id.tvTitle);
        TextView btN = (TextView) findViewById(R.id.btN);
        TextView btY = (TextView) findViewById(R.id.btY);
        textView.setText(title);
        btN.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        btY.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.yes();
                dismiss();
            }
        });
    }

    public interface CallBack{
        void yes();
    }
}
